
ifeq ($(obj),)
obj = .
endif

p7841-objs	:= 7841.o plx_util.o adlload.o isrdpc.o

obj-m           := p7841.o

ifneq ($(KERNELRELEASE),)
dummy	:= $(shell echo $(KERNELRELEASE) > $(obj)/.version)

CC += -I$(obj)

p7841.o: $(p7841-objs)
	$(LD) -r -o $@ $(p7841-objs)

else
KERNELRELEASE   := $(shell cat $(obj)/.version 2>/dev/null || uname -r)
endif

KDIR		:= /lib/modules/$(KERNELRELEASE)/build
PWD		:= $(shell pwd)

# locales seem to cause trouble sometimes.
LC_ALL = POSIX
export LC_ALL


default::
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
	cp -f p7841.ko ../driver/

clean::
	-rm -f *~ *.o *.ko *.mod.c
	-rm -f .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd

